﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WebApp.Entities
{
    /// <summary>
    /// 
    /// </summary>
    [Table("collector")]
    public partial class Collector
    {
        /// <summary>
        /// 
        /// </summary>
        [Key]
        public int Id { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required]
        public int AppId { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [Required]
        [MaxLength(12)]
        public string Code { get; set; }
        /// <summary>
        /// 安装位置
        /// </summary>
        [MaxLength(128)]
        public string Address { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DateTime HeartbeatTime { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime CreateDate { get; set; }
        [ForeignKey("AppId")]
        public virtual Application App { get; set; }
        /// <summary>
        /// 1可用，0不可用
        /// </summary>
        public int Status { get; set; } = 1;

        [ForeignKey("CollectorId")]
        public virtual ICollection<Meter> Meters { get; set; }
    }
}
